define([
  "knockout",
  "viewmodels/life-cycleA",
  "viewmodels/life-cycleB"
], function(ko, LifeCycleA, LifeCycleB) {
  var lcA = new LifeCycleA();
  var lcB = new LifeCycleB();
  var view = ko.observable(lcA);
  var color=ko.observable('red');

  setTimeout(() => {
    color('green');
  }, 1000);
  return {
    view: view,
    changeToA: function() {
      lcA.list([]);
      view(lcA);
    },
    changeToB: function() {
      lcB.list([]);
      view(lcB);
    },
    styleObj: ko.pureComputed(function() {
      return { color: color(), fontSize: "20px" };
    })
  };
});
